/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package persistencia.controller;

import bean.BuscaChaveEstrangeira;
import bean.CondicaoCompra;
import groovy.lang.GroovyClassLoader;
import java.io.File;
import java.util.Vector;

/**
 *
 * @author André
 */
public class CondicaoController implements ICondicaoController {

    public static CondicaoController instance;
    private ICondicaoController mgr;

    public static CondicaoController getInstance() {
        if (instance == null) {
            instance = new CondicaoController();
        }
        return instance;
    }

    private CondicaoController() {
        try {
            GroovyClassLoader groovyClassLoader = new GroovyClassLoader();
            Class classeProxy = groovyClassLoader.parseClass(
                    //new File("./src/java/persistencia/controller/CondicaoController.groovy"));
                    new File("D:/UEFS/Implementação TCC/codigos/CondicaoCompraWS/src/java/persistencia/controller/CondicaoController.groovy"));
            mgr = (ICondicaoController) classeProxy.newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    public boolean deleteCondicao(Integer codigoCondicao) {
        return mgr.deleteCondicao(codigoCondicao);
    }

    public boolean createCondicao(CondicaoCompra condicao) {
        return mgr.createCondicao(condicao);
    }

    public boolean updateCondicao(CondicaoCompra condicao) {
        return mgr.updateCondicao(condicao);
    }

    public Vector<BuscaChaveEstrangeira> searchGrupoPorId(Integer codigo) {
        return mgr.searchGrupoPorId(codigo);
    }

    public Vector<BuscaChaveEstrangeira> searchGrupoPorNome(String descricao) {
        return mgr.searchGrupoPorNome(descricao);
    }

    public Vector<CondicaoCompra> readCondicao(String descricao) {
        return mgr.readCondicao(descricao);
    }

    public CondicaoCompra readCondicaoPorId(Integer codigoCondicao) {
        return mgr.readCondicaoPorId(codigoCondicao);
    }
}
